package 力扣日常刷题.木22二月.第05天211;

import java.util.Arrays;

/**
 * @author 帅小伙
 * @date 2022/2/11
 * @description
 */
public class Demo40把数组排成最小的数 {


    public String minNumber(int[] nums) {
        String[] arr = new String[nums.length];
        for (int i = 0; i < nums.length; i++)
            arr[i] = String.valueOf(nums[i]);
        Arrays.sort(arr,(a,b)->(a+b).compareTo(b+a));
        StringBuilder sb = new StringBuilder();
        for (String s : arr)
            sb.append(s);
        return sb.toString();
    }

}
